package com.zhang.controller;


import com.zhang.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/html")
public class forward_redirect_Controller {
    //重定向~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //绝对路径
    @RequestMapping("test1")
    public String test1(){
        return "redirect:/html/login.html";

    }

    //相对路径
    @RequestMapping("test2")
    public String test2(ModelAndView modelAndView){
        return "redirect:login.html";

    }


    //请求转发~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //绝对路径1
    @RequestMapping("test3")
    public String test3(){
        return "forward:/html/login.html";
    }

    //绝对路径2
    @RequestMapping("test4")
    public String test4(){
        return "login";
    }

    //相对路径
    @RequestMapping("test5")
    public String test5(){
        return "forward:login.html";
    }











}














